#!/usr/bin/perl
#

# Do not remove the following lines.
my $TOOLS_VERSION = "V1_5_1";

# 
################################################################################################
# Post Processing template script under Windows based machines
# Windows Usage: 
#  -post-processing-command <AbspathToPerl>\perl.exe <AbsPathToScript>\PostProcessingTemplate.pl
# Unix Usage:
#  -post-processing-command /<patToScript>/PostProcessingTemplate.pl
#        Example substituibs are shown, create or uncomment and update rule
#        as requiered.
################################################################################################

# do not remove: mandatory to have output in a binmodek, i.e. Compatibility with r2008a Windows based machines
binmode STDOUT;

# Process every line from STDIN until EOF
while ($line = <STDIN>) 
{
  # Example 1: Remove memsection(anything) text
  #$line =~ s/memsection\([A-Za-z"" 0-9]*\)//g;
  
  $line =~ s/if\(SPC_RECV_FLAG\)//g;
   $line =~ s/if\(HPA_RECV_FLAG\)//g;
    $line =~ s/if\(UDC_RECV_FLAG\)//g;
 
	
  # Example 2: Remove "@ 0xFE1A" address constructs
  #$line =~ s/\@\s0x[A-F0-9]*//g;

  # Example 3: Remove "@0xFE1" address constructs
  # s/\@0x[A-F0-9]*//g;

  # Example 4: Remove "@ ((unsigned)&LATD*8)+2" type constructs
  #s/\@\s\(\(unsigned\)\&[A-Z0-9]+\*8\)\+\d//g;
  
  # Example 5: Convert current line to lower case
  # $_ =~ tr/A-Z/a-z/;

  # DONT DELETE: Print the current processed line to STDOUT
  print $line;
}

############################################################################
# Perl Regular Expressions Summary  
############################################################################
# Metacharacter    What it matches
############################################################################
# Single Characters
# .                Any character except newline
# [a-z0-9]         Any single character in the set
# [^a-z0-9]        Any character not in set
# \d               A digit same as 
# \D               A non digit same as [^0-9]
# \w               An Alphanumeric (word) character
# \W               Non Alphanumeric (non-word) character
# \cX              Control character X
#
# Whitespace Characters
# \s               Whitespace character
# \S               Non-whitespace character
# \n               newline
# \r               return
# \t               tab
# \f               formfeed
# \b               backspace
#
# Anchored Characters
# \b               word boundary when not inside []
# \B               non-word boundary
# \A               Match beginning of a string (multi-line matches /m)
# \Z               Match end of a string (multi-line matches /m)
# ^                Matches to beginning of line
# $                Matches to end of line
#
# Repeated Characters
# x?               0 or 1 occurrence of x
# x*               0 or more x's
# x+               1 or more x's
# x{m,n}           Matches at least m x's and no more than n x's
# abc              All of abc respectively
# to|be|great      One of "to", "be"  or "great"
# 
# Remembered Characters
# (string)         Used for back referencing see below
# \1 or $1         First set of parentheses
# \2 or $2         First second of parentheses
# \3 or $3         First third of parentheses
#############################################################################
# Back referencing 
# e.g. swap first two words around on a line
# red cat -> cat red
# s/(\w+) (\w+)/$2 $1/;
#
# Side effects
# $& contains the entire matched string
# $` Everything in the string before match
# $' Everything in the string after match
#############################################################################
# Pattern match modifiers
#
# string =~ s/search_pattern/replacement_pattern/[g][i][e][o][m]
#
# Where g = global across line 
#       i = case insensitive
#       e = evaluate replacement string as an expression
#       o = optimise
#       m = treat the string as multiple line
#       x = ignore white space
#############################################################################

